# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductStatusChangeMessage do
  @moduledoc """
  The message that the merchant will receive to notify about product status change event

  ## Attributes

  *   `account` (*type:* `String.t`, *default:* `nil`) - The target account that owns the entity that changed. Format : `accounts/{merchant_id}`
  *   `attribute` (*type:* `String.t`, *default:* `nil`) - The attribute in the resource that changed, in this case it will be always `Status`.
  *   `changes` (*type:* `list(GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductChange.t)`, *default:* `nil`) - A message to describe the change that happened to the product
  *   `expirationTime` (*type:* `DateTime.t`, *default:* `nil`) - The product expiration time.
  *   `managingAccount` (*type:* `String.t`, *default:* `nil`) - The account that manages the merchant's account. can be the same as merchant id if it is standalone account. Format : `accounts/{service_provider_id}`
  *   `resource` (*type:* `String.t`, *default:* `nil`) - The product name. Format: `{product.name=accounts/{account}/products/{product}}`
  *   `resourceId` (*type:* `String.t`, *default:* `nil`) - The product id.
  *   `resourceType` (*type:* `String.t`, *default:* `nil`) - The resource that changed, in this case it will always be `Product`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :account => String.t() | nil,
          :attribute => String.t() | nil,
          :changes => list(GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductChange.t()) | nil,
          :expirationTime => DateTime.t() | nil,
          :managingAccount => String.t() | nil,
          :resource => String.t() | nil,
          :resourceId => String.t() | nil,
          :resourceType => String.t() | nil
        }

  field(:account)
  field(:attribute)
  field(:changes, as: GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductChange, type: :list)
  field(:expirationTime, as: DateTime)
  field(:managingAccount)
  field(:resource)
  field(:resourceId)
  field(:resourceType)
end

defimpl Poison.Decoder, for: GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductStatusChangeMessage do
  def decode(value, options) do
    GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductStatusChangeMessage.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductStatusChangeMessage do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
